﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace ContosoUniversity.Models
{
    public class Instructor
    {
        [Key]
        public int ID { get; set; }

        [Required(ErrorMessage = "{0}必填")]
        [Display(Name = "Last Name")]
        [StringLength(50, ErrorMessage = "{0}不超过50位")]
        public string LastName { get; set; }

        [Required(ErrorMessage = "{0}必填")]
        [Display(Name = "First Name")]
        [Column("FirstName")]
        [StringLength(50, ErrorMessage = "{0}不超过50位")]
        public string FirstMidName { get; set; }

        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        [Display(Name = "Hire Date")]
        public DateTime HireDate { get; set; }


        public string FullName
        {
            get { return LastName + "," + FirstMidName; }
        }

        public ICollection<CourseAssignment> CourseAssignments { get; set; }

        /// <summary>
        /// 老师和办公室是一对一关系
        /// </summary>
        public OfficeAssignment OfficeAssignment { get; set; }

    }
}
